<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/public/base.jspf"%>
<body>
	<form id="addOrUpdate" method="post">
		<hidden id="hidden-params">
			<input id="btn_sub" type="hidden" onclick="submitForm()"/>
			<input id="goods_type_ids" name="goodsTypeIds" value="${m.goodsTypeIds}" type="hidden"/>
			<input id="goods_brand_id" name="goodsBrandId" value="${m.goodsBrandId}" type="hidden"/>
		</hidden>
		<div>   
	        <label for="type_tree_menu">商品类型:</label>
	        <input id="type_tree_menu" />
	    </div>
	    <div>
	        <label for="brand_tree_menu">商品品牌:</label>
	        <input id="brand_tree_menu" />
	    </div>
	    <div>
	        <label for="goods_info">商品说明:</label>
	        <input id="goods_info" name="goodsInfo" />
	    </div>
	    <div>
	        <label for="buy_notes">购买须知:</label>
	        <input id="buy_notes" name="buyNotes" />
	    </div>
	</form>
	<script type="text/javascript">
		var id = '${m.id}';
		//如果不为空，表示修改操作
		if(id!='' && id!=undefined){
			$('#hidden-params').append('<input name="id" value="${m.id}" type="hidden" />');
			$('#hidden-params').append('<input name="_method" value="put" type="hidden"/>');
		}
		$('#type_tree_menu').combotree({
		    url: '${xpath}/goodsType/pageList',
		    required: true,//是否必选
		    multiple:true,//是否支持多选
		    panelWidth:230,
		    loadFilter:function(data){
	        	return data.obj;
	        },
	        onLoadSuccess:function(row,data){
	        	var goodsTypeIds = '${m.goodsTypeIds}';
	        	if(goodsTypeIds!='' && goodsTypeIds!=undefined){
	        		$('#type_tree_menu').combotree('setValues',goodsTypeIds);
	        	}
	        }
		});
		function submitForm(){
			$('#addOrUpdate').form('submit', {
			    url:'manage',
			    onSubmit: function(params){//提交之前
			    	
			    },
			    success:function(data){//提交成功回调函数
			    	var info = eval('('+data+')');
			    	if(info.success){
			    		
			    	}else{
				    	$.messager.alert('消息',info.msg);
			    	}
			    }
			});  
		}
	</script>
</body>